package org.goldfish.distributed_framework.client;

import java.io.Serial;
import java.io.Serializable;
import java.util.Arrays;

public class RpcRequest implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    private String serviceName;   // 服务名，比如 "echo"
    private String methodName;    // 方法名
    private Class<?>[] paramTypes; // 参数类型
    private Object[] parameters;   // 参数值

    public RpcRequest() {}

    public RpcRequest(String serviceName, String methodName, Class<?>[] paramTypes, Object[] parameters) {
        this.serviceName = serviceName;
        this.methodName = methodName;
        this.paramTypes = paramTypes;
        this.parameters = parameters;
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    public Class<?>[] getParamTypes() {
        return paramTypes;
    }

    public void setParamTypes(Class<?>[] paramTypes) {
        this.paramTypes = paramTypes;
    }

    public Object[] getParameters() {
        return parameters;
    }

    public void setParameters(Object[] parameters) {
        this.parameters = parameters;
    }

    @Override
    public String toString() {
        return "RpcRequest{" +
                "serviceName='" + serviceName + '\'' +
                ", methodName='" + methodName + '\'' +
                ", paramTypes=" + Arrays.toString(paramTypes) +
                ", parameters=" + Arrays.toString(parameters) +
                '}';
    }
}
